using System.Drawing;
using System.Windows.Forms;

namespace TXLooker.WorkItemExtention.UI.QueryManager
{
    internal class DataGridViewRolloverCell : DataGridViewTextBoxCell
    {
        // Methods
        protected override void OnMouseEnter(int rowIndex)
        {
            base.DataGridView.InvalidateCell(this);
        }

        protected override void OnMouseLeave(int rowIndex)
        {
            base.DataGridView.InvalidateCell(this);
        }

        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
            Point pt = base.DataGridView.PointToClient(Cursor.Position);
            if (((rowIndex != 0) || (base.ColumnIndex != 1)) && cellBounds.Contains(pt))
            {
                Rectangle rect = new Rectangle(cellBounds.X + 1, cellBounds.Y + 1, cellBounds.Width - 4, cellBounds.Height - 4);
                graphics.DrawRectangle(Pens.Red, rect);
            }
        }
    }
}